package com.cmc6.pay.controller;

import com.cmc6.pay.model.dto.AliPayDTO;
import com.cmc6.pay.service.PayService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

@RestController
@RequestMapping(value = "/pay")
@Api(tags = "支付控制器")
public class PayController {

    @Resource
    PayService baseService;

    @ApiOperation(value = "支付宝支付接口")
    @PostMapping(value = "/aliPay")
    public String aliPay(@RequestBody @Valid AliPayDTO dto) {
        return baseService.aliPay(dto);
    }

    @ApiOperation(value = "服务器异步通知，备注：第三方应用调用")
    @PostMapping(value = "/notifyCallBack")
    public String notifyCallBack(HttpServletRequest request) {
        return baseService.notifyCallBack(request);
    }

}
